$(async function() {
    try {
        // 2.图片新闻数据
        const pics = await axios({
            method: 'get',
            url: 'api/index/pic'
        })
        const picHtml = template('picTpl', {
            pics
        })
        $('#main1 ul').html(picHtml)

        // 3.最新新闻
        const newArticles = await axios({
            method: 'get',
            url: 'api/index/new'
        })
        const newArticlesTpl = template('newArticlesTpl', {
            newArticles
        })
        $('.newArticles').html(newArticlesTpl)


        // 4.最热新闻
        const hotArticles = await axios({
            method: 'get',
            url: 'api/index/hot'
        })
        const hotArticlesTpl = template('hotArticlesTpl', {
            hotArticles
        })
        $('.hotArticles').html(hotArticlesTpl)
    } catch (err) {
        console.log(err);
    }



})